cmake_minimum_required(VERSION 3.14.1)

project(network)

# open source include3

# zekernel include_directories
set(ZEKERNEL_PATH            ${INTARKDB_SRC_PATH}/storage/gstor/zekernel)
set(SQL_ENGINE_INC_PATH      ${INTARKDB_SRC_PATH}/compute/sql/include)
set(FMT_INC_PATH             ${INTARKDB_HOME}/dependency/fmt/include)
set(ZEKERNEL_KERNEL_PATH     ${ZEKERNEL_PATH}/kernel)
set(ZEKERNEL_COMMON_PATH     ${ZEKERNEL_PATH}/common)
set(NETWORK_PATH             ${CMAKE_CURRENT_SOURCE_DIR})
set(NETWORK_NETWORK_PATH    ${CMAKE_CURRENT_SOURCE_DIR}/network)
set(NETWORK_COMMON_PATH     ${CMAKE_CURRENT_SOURCE_DIR}/common)

set(SECUREC_INC_PATH        "${INTARKDB_HOME}/output/inc/huawei_security")
set(OPENSSL_PATH            "${INTARKDB_HOME}/output/inc/openssl/")
set(OPENSSL_PATH_EX         "${INTARKDB_HOME}/output/inc/openssl/openssl")
set(LZ4_INC_PATH            "${INTARKDB_HOME}/output/inc/lz4")
set(ZLIB_INC_PATH           "${INTARKDB_HOME}/output/inc/zlib")
set(ZSTANDARD_INC_PATH      "${INTARKDB_HOME}/output/inc/zstd")
set(CJSON_INC_PATH          "${INTARKDB_HOME}/output/inc/cJSON")
if (ENABLE_LIBAIO)
set(LIBAIO_INC_PATH         "${INTARKDB_HOME}/output/inc/libaio")
endif()

include_directories(${INTARKDB_HOME})
include_directories(${INTARKDB_HOME}/src)
include_directories(${SECUREC_INC_PATH})
include_directories(${SQL_ENGINE_INC_PATH})
include_directories(${FMT_INC_PATH})
include_directories(${NETWORK_PATH})
include_directories(${NETWORK_PATH}/client)
include_directories(${INTARKDB_HOME}/output/inc/libpg_query)
if (ENABLE_SSL)
    include_directories(${OPENSSL_PATH})
    include_directories(${OPENSSL_PATH_EX})
endif()
include_directories(${LZ4_INC_PATH})
include_directories(${ZLIB_INC_PATH})
if (ENABLE_ZSTD)
    include_directories(${ZSTANDARD_INC_PATH})
endif()
if (ENABLE_LIBAIO)
    include_directories(${LIBAIO_INC_PATH})
endif()
include_directories(${CJSON_INC_PATH})
include_directories(${PCRE_INC_PATH})
include_directories(${ZEKERNEL_COMMON_PATH})
include_directories(${ZEKERNEL_COMMON_PATH}/variant)
include_directories(${ZEKERNEL_KERNEL_PATH})
include_directories(${NETWORK_NETWORK_PATH})
include_directories(${NETWORK_COMMON_PATH})
if(ENABLE_BACKUP)
    include_directories(${ZEKERNEL_KERNEL_PATH}/backup)
endif()
include_directories(${ZEKERNEL_KERNEL_PATH}/buffer)
include_directories(${ZEKERNEL_KERNEL_PATH}/common)
include_directories(${ZEKERNEL_KERNEL_PATH}/daemon)
include_directories(${ZEKERNEL_KERNEL_PATH}/flashback)
include_directories(${ZEKERNEL_KERNEL_PATH}/include)
include_directories(${ZEKERNEL_KERNEL_PATH}/index)
include_directories(${ZEKERNEL_KERNEL_PATH}/lob)
include_directories(${ZEKERNEL_KERNEL_PATH}/persist)
include_directories(${ZEKERNEL_KERNEL_PATH}/backup)
include_directories(${ZEKERNEL_KERNEL_PATH}/sequence)
if(STATISTICS)
    include_directories(${ZEKERNEL_KERNEL_PATH}/statistics)
endif()
include_directories(${ZEKERNEL_KERNEL_PATH}/table)
include_directories(${ZEKERNEL_KERNEL_PATH}/xact)
include_directories(${ZEKERNEL_KERNEL_PATH}/tablespace)
include_directories(${ZEKERNEL_KERNEL_PATH}/catalog)
include_directories(${SERVER_COMMON_PATH})
include_directories(${INTARKDB_HOME}/interface/c)

link_directories(${LIBRARY_OUTPUT_PATH})

#add_compile_options(-fvisibility=hidden)
#add_compile_options(-fPIC -Wall)
add_compile_options(-fPIC -w)
set(CMAKE_CXX_STANDARD 17)
add_subdirectory(login)
add_subdirectory(protocol)
add_subdirectory(network)
add_subdirectory(common)
add_subdirectory(server)
#add_subdirectory(client)

